<template>
	<base-popup :title="$t('wallet.channelSelect')" :modelValue="modelValue" @close="onClose">
		<div class="channel-select">
			<div
				class="h-[64px] flex items-center"
				v-for="item in data"
				:key="item.id"
				@click="onSelect(item)">
				<div class="icon-wrapper">
					<base-icon name="tick" v-if="value === item" />
				</div>
				<div class="ml-[11px] flex-[4]">{{ item.name }}</div>
			</div>
		</div>
	</base-popup>
</template>

<script lang="ts" setup>
import { PropType } from 'vue'
import { BasePopup, BaseIcon } from '@/components/base'

defineProps({
	modelValue: {
		type: Boolean,
		required: true
	},
	value: {
		type: Object
	},
	data: {
		type: Array as PropType<any[]>,
		required: true
	}
})

const emits = defineEmits(['update:modelValue', 'select'])

const onSelect = (item: any) => {
	emits('select', item)
	onClose()
}

const onClose = () => {
	emits('update:modelValue', false)
}
</script>
<style lang="scss" scoped></style>
